from coin.exchange.base.kr_rest.py_product import PyProduct
from coin.exchange.base.kr_rest.product_info import (
    ProductInfo, ProductHolder, ProductInfoConstant)
from coin.exchange.uniswap_v3.kr_rest.constants import pi_file

_product_info = ProductInfoConstant(pi_file)


def get_holder_from_product(product):
  if isinstance(product, PyProduct):
    assert product.market_name.lower() == 'spot' and product.exchange_name.lower() == 'uniswap'

  product_info = _product_info.get_product_info(product.native_symbol)
  return ProductHolder(product, product_info)
